import request from '@/utils/request'

// 获取工单信息
export function getWorkorderInfo(id) {
    return request({
        url: `/api/Business/Workorder/${id}`,
        method: 'GET'
    })
}

// 获取工单信息列表
export function getWorkorderList(data) {
    return request({
        url: `/api/Business/Workorder`,
        method: 'GET',
        data
    })
}

// 添加工单信息
export function createWorkorder(data) {
    return request({
        url: '/api/Business/Workorder',
        method: 'POST',
        data
    })
}

// 更新工单信息
export function updateWorkorder(data) {
    return request({
        url: `/api/Business/Workorder/${data.id}`,
        method: 'PUT',
        data
    })
}

// 批量删除工单信息
export function delWorkorderBatch(data) {
    return request({
        url: `/api/Business/Workorder/BatchRemove`,
        method: 'POST',
        data
    })
}
// 删除工单信息
export function delWorkorder(id) {
    return request({
        url: `/api/Business/Workorder/${id}`,
        method: 'DELETE'
    })
}

// 导出工单信息
export function exportData(data) {
    return request({
        url: `/api/Business/Workorder/Actions/Export`,
        method: 'GET',
        data
    })
}
// 完工
export function finishWorkorder(id) {
    console.log(id)
    return request({
        url: `/api/Business/Workorder/Finish/${id}`,
        method: 'POST'
    })
}


// 获取报工信息列表
export function getWorkreportList(data) {
    return request({
        url: `/api/Business/Workreport`,
        method: 'GET',
        data
    })
}
// 新增报工
export function createWorkReport(data) {
    return request({
        url: '/api/Business/Workreport',
        method: 'POST',
        data
    })
}
// 删除报工
export function delWorkreport(id) {
    return request({
        url: `/api/Business/Workreport/${id}`,
        method: 'DELETE'
    })
}